


<table class="table dhis2-list-table-striped dhis2-table-hover">
    <tr>
        <td>{{'ou_search_scope'| translate}}</td>
        <td>                    
            <label><input type="radio" ng-model="customWorkingListValues.ouMode.name" name="selected" ng-attr-value="SELECTED"> {{'SELECTED'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.ouMode.name" name="children" ng-attr-value="CHILDREN"> {{'CHILDREN'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.ouMode.name" name="descendants" ng-attr-value="DESCENDANTS"> {{'DESCENDANTS'| translate}}</label><br/>
        </td>
    </tr>
    <tr ng-if="base.selectedProgram">
        <td>{{'enrollment_status' | translate}}</td>
        <td >
            <label><input type="radio" ng-model="customWorkingListValues.programStatus" name="All" ng-attr-value=""> {{'all'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.programStatus" name="Completed" ng-attr-value="COMPLETED"> {{'completed'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.programStatus" name="Active" ng-attr-value="ACTIVE"> {{'active'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.programStatus" name="Cancelled" ng-attr-value="CANCELLED"> {{'cancelled'| translate}}</label><br/>
        </td>
    </tr>
    <tr ng-if="base.selectedProgram">
        <td>{{base.selectedProgram.enrollmentDateLabel}}</td>
        <td>
            <input type="text" 
                ng-attr-placeholder="{{'start_date'| translate}}" 
                class="form-control" 
                d2-date 
                d2-date-validator
                max-date="customWorkingListValues.enrollment.programEnrollmentEndDate ? customWorkingListValues.enrollment.programEnrollmentEndDate : base.selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
                ng-model="customWorkingListValues.enrollment.programEnrollmentStartDate"/>
            <input type="text" 
                ng-attr-placeholder="{{'end_date'| translate}}" 
                class="form-control" 
                d2-date 
                min-date="customWorkingListValues.enrollment.programEnrollmentStartDate ? customWorkingListValues.enrollment.programEnrollmentStartDate : ''"
                max-date="base.selectedProgram.selectEnrollmentDatesInFuture ? '' : 0"
                ng-model="customWorkingListValues.enrollment.programEnrollmentEndDate"/>


        </td>
    </tr>
    <tr ng-if="base.selectedProgram && base.selectedProgram.displayIncidentDate">
        <td>{{base.selectedProgram.incidentDateLabel}}</td>
        <td>
            <input type="text" 
                    ng-attr-placeholder="{{'start_date'| translate}}" 
                    class="form-control" 
                    d2-date 
                    d2-date-validator
                    max-date="customWorkingListValues.enrollment.programIncidentEndDate ? customWorkingListValues.enrollment.programIncidentEndDate : base.selectedProgram.selectIncidentDatesInFuture ? '' : 0"
                    ng-model="customWorkingListValues.enrollment.programIncidentStartDate"/>
            <input type="text" 
                    ng-attr-placeholder="{{'end_date'| translate}}" 
                    class="form-control" 
                    d2-date 
                    d2-date-validator
                    min-date="customWorkingListValues.enrollment.programIncidentStartDate ? customWorkingListValues.enrollment.programIncidentStartDate : ''"
                    max-date="base.selectedProgram.selectIncidentDatesInFuture ? '' : 0"
                    ng-model="customWorkingListValues.enrollment.programIncidentEndDate"/>
        </td>
    </tr>
    <tr>
        <td>{{'user_assignment' | translate}}</td>
        <td>
            <label><input type="radio" ng-model="customWorkingListValues.assignedUserMode" name="NOREQ" ng-attr-value=""> {{'no_requirement'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.assignedUserMode" name="ANY" ng-attr-value="ANY"> {{'any'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.assignedUserMode" name="NONE" ng-attr-value="NONE"> {{'none'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.assignedUserMode" name="CURRENT" ng-attr-value="CURRENT"> {{'current'| translate}}</label><br/>
            <label><input type="radio" ng-model="customWorkingListValues.assignedUserMode" name="PROVIDED" ng-attr-value="PROVIDED"> {{'specific_users'| translate}}</label><br/>

            <input ng-if="customWorkingListValues.assignedUserMode == 'PROVIDED'" type="text" class="form-control" ng-attr-placeholder="{{'user1_uid;user2_uid;user3_uid'}}" ng-model="customWorkingListValues.assignedUsers">
        </td>
    </tr>
    <tr ng-repeat="attribute in customWorkingListValues.attributes | nonConfidential">
        <td>
            {{attribute.displayName}}
        </td>
        <td>
            <div ng-if="attribute.optionSetValue">
                <select multiple ui-select2 ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
                    <option ng-repeat="option in optionSets[attribute.optionSet.id].options | filter:$viewValue | limitTo:maxOptionSize" ng-attr-value="{{option.code}}">{{option.displayName}}</option>
                </select>
            </div>
            <div ng-if="!attribute.optionSetValue" ng-switch="attribute.valueType">
                <div ng-switch-when="NUMBER">                                               
                        <div class="filter-operator">
                            <select ng-model="attribute.operator" class="form-control" ng-options="operator | translate for operator in defaultOperators">
                            </select>
                        </div>
                        <div class="filter-value" ng-show="attribute.operator === defaultOperators[0]">
                            <input type="number" ng-attr-placeholder="{{'exact_value'| translate}}" class="form-control" ng-model="attribute.exactValue"/>
                        </div>
                        <div class="filter-value" ng-show="attribute.operator === defaultOperators[1]">
                                <input type="number" ng-attr-placeholder="{{'from'| translate}}" class="form-control" ng-model="attribute.startValue"/>
                                <input type="number" ng-attr-placeholder="{{'to'| translate}}" class="form-control" ng-model="attribute.endValue"/>
                        </div>                     
                </div>
                <div ng-switch-when="DATE">
                    <div class="filter-operator">
                        <select ng-model="attribute.operator" class="form-control" ng-options="operator | translate for operator in defaultOperators">
                        </select>
                    </div>
                    <div class="filter-value" ng-show="attribute.operator === defaultOperators[0]">
                        <input type="text" ng-attr-placeholder="{{'exact_date'| translate}}" class="form-control" d2-date ng-model="attribute.exactValue"/>
                    </div>
                    <div class="filter-value" ng-show="attribute.operator === defaultOperators[1]">
                            <input type="text" ng-attr-placeholder="{{'start_date'| translate}}" class="form-control" d2-date ng-model="attribute.startValue"/>
                            <input type="text" ng-attr-placeholder="{{'end_date'| translate}}" class="form-control" d2-date ng-model="attribute.endValue"/>
                    </div>
                </div>
                <div ng-switch-when="DATETIME">
                    <div class="filter-operator">
                        <select ng-model="attribute.operator" class="form-control" ng-options="operator | translate for operator in defaultOperators">
                        </select>
                    </div>
                    <div class="filter-value" ng-show="attribute.operator === defaultOperators[0]">
                        <input type="text" ng-attr-placeholder="{{'exact_date'| translate}}" class="form-control" d2-date ng-model="attribute.exactValue"/>
                    </div>
                    <div class="filter-value" ng-show="attribute.operator === defaultOperators[1]">
                        <input type="text" ng-attr-placeholder="{{'start_date'| translate}}" class="form-control" d2-date ng-model="attribute.startValue"/>
                        <input type="text" ng-attr-placeholder="{{'end_date'| translate}}" class="form-control" d2-date ng-model="attribute.endValue"/>                
                    </div>                         
                </div>
                <div ng-switch-when="TIME">
                    <input type="text" ng-attr-placeholder="TIME NOT SEARCHABLE" class="form-control"  ng-disabled="true"/>
                </div>
                <div ng-switch-when="BOOLEAN">
                    <select ui-select2 multiple ng-model="attribute.value" data-placeholder="{{'please_select'| translate}}" style="width:100%;">
                        <option ng-repeat="option in boolOperators" ng-attr-value="{{option}}">{{option}}</option>
                    </select>
                </div> 
                <div ng-switch-default>
                    <input type="text" class="form-control" ng-model="attribute.value" /> 
                </div>
            </div>
        </td>
    </tr>         
</table>


<div class="horizontal-spacing">
<button type="button"
        class="btn btn-primary dropdown-toggle"
        ng-click="setCustomWorkingList()" data-toggle="dropdown">
    {{'search'| translate}}
</button>        
</div>